home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Source / GNU / cc / gcc.info-18 (.txt) < prev    next >
GNU Info File  |  1993-10-21  |  49KB  |  825 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License" and "Protect
  13. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  14. original, and provided that the entire resulting derived work is
  15. distributed under the terms of a permission notice identical to this
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that the sections entitled "GNU General Public
  19. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  20. permission notice, may be included in translations approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: gcc.info,  Node: Obsolete Register Macros,  Prev: Stack Registers,  Up: Registers
  23. Obsolete Macros for Controlling Register Usage
  24. ----------------------------------------------
  25.    These features do not work very well.  They exist because they used
  26. to be required to generate correct code for the 80387 coprocessor of the
  27. 80386.  They are no longer used by that machine description and may be
  28. removed in a later version of the compiler.  Don't use them!
  29. `OVERLAPPING_REGNO_P (REGNO)'
  30.      If defined, this is a C expression whose value is nonzero if hard
  31.      register number REGNO is an overlapping register.  This means a
  32.      hard register which overlaps a hard register with a different
  33.      number.  (Such overlap is undesirable, but occasionally it allows
  34.      a machine to be supported which otherwise could not be.)  This
  35.      macro must return nonzero for *all* the registers which overlap
  36.      each other.  GNU CC can use an overlapping register only in
  37.      certain limited ways.  It can be used for allocation within a
  38.      basic block, and may be spilled for reloading; that is all.
  39.      If this macro is not defined, it means that none of the hard
  40.      registers overlap each other.  This is the usual situation.
  41. `INSN_CLOBBERS_REGNO_P (INSN, REGNO)'
  42.      If defined, this is a C expression whose value should be nonzero if
  43.      the insn INSN has the effect of mysteriously clobbering the
  44.      contents of hard register number REGNO.  By "mysterious" we mean
  45.      that the insn's RTL expression doesn't describe such an effect.
  46.      If this macro is not defined, it means that no insn clobbers
  47.      registers mysteriously.  This is the usual situation; all else
  48.      being equal, it is best for the RTL expression to show all the
  49.      activity.
  50. `PRESERVE_DEATH_INFO_REGNO_P (REGNO)'
  51.      If defined, this is a C expression whose value is nonzero if
  52.      accurate `REG_DEAD' notes are needed for hard register number REGNO
  53.      at the time of outputting the assembler code.  When this is so, a
  54.      few optimizations that take place after register allocation and
  55.      could invalidate the death notes are not done when this register is
  56.      involved.
  57.      You would arrange to preserve death info for a register when some
  58.      of the code in the machine description which is executed to write
  59.      the assembler code looks at the death notes.  This is necessary
  60.      only when the actual hardware feature which GNU CC thinks of as a
  61.      register is not actually a register of the usual sort.  (It might,
  62.      for example, be a hardware stack.)
  63.      If this macro is not defined, it means that no death notes need to
  64.      be preserved.  This is the usual situation.
  65. File: gcc.info,  Node: Register Classes,  Next: Stack and Calling,  Prev: Registers,  Up: Target Macros
  66. Register Classes
  67. ================
  68.    On many machines, the numbered registers are not all equivalent.
  69. For example, certain registers may not be allowed for indexed
  70. addressing; certain registers may not be allowed in some instructions.
  71. These machine restrictions are described to the compiler using
  72. "register classes".
  73.    You define a number of register classes, giving each one a name and
  74. saying which of the registers belong to it.  Then you can specify
  75. register classes that are allowed as operands to particular instruction
  76. patterns.
  77.    In general, each register will belong to several classes.  In fact,
  78. one class must be named `ALL_REGS' and contain all the registers.
  79. Another class must be named `NO_REGS' and contain no registers.  Often
  80. the union of two classes will be another class; however, this is not
  81. required.
  82.    One of the classes must be named `GENERAL_REGS'.  There is nothing
  83. terribly special about the name, but the operand constraint letters `r'
  84. and `g' specify this class.  If `GENERAL_REGS' is the same as
  85. `ALL_REGS', just define it as a macro which expands to `ALL_REGS'.
  86.    Order the classes so that if class X is contained in class Y then X
  87. has a lower class number than Y.
  88.    The way classes other than `GENERAL_REGS' are specified in operand
  89. constraints is through machine-dependent operand constraint letters.
  90. You can define such letters to correspond to various classes, then use
  91. them in operand constraints.
  92.    You should define a class for the union of two classes whenever some
  93. instruction allows both classes.  For example, if an instruction allows
  94. either a floating point (coprocessor) register or a general register
  95. for a certain operand, you should define a class `FLOAT_OR_GENERAL_REGS'
  96. which includes both of them.  Otherwise you will get suboptimal code.
  97.    You must also specify certain redundant information about the
  98. register classes: for each class, which classes contain it and which
  99. ones are contained in it; for each pair of classes, the largest class
  100. contained in their union.
  101.    When a value occupying several consecutive registers is expected in a
  102. certain class, all the registers used must belong to that class.
  103. Therefore, register classes cannot be used to enforce a requirement for
  104. a register pair to start with an even-numbered register.  The way to
  105. specify this requirement is with `HARD_REGNO_MODE_OK'.
  106.    Register classes used for input-operands of bitwise-and or shift
  107. instructions have a special requirement: each such class must have, for
  108. each fixed-point machine mode, a subclass whose registers can transfer
  109. that mode to or from memory.  For example, on some machines, the
  110. operations for single-byte values (`QImode') are limited to certain
  111. registers.  When this is so, each register class that is used in a
  112. bitwise-and or shift instruction must have a subclass consisting of
  113. registers from which single-byte values can be loaded or stored.  This
  114. is so that `PREFERRED_RELOAD_CLASS' can always have a possible value to
  115. return.
  116. `enum reg_class'
  117.      An enumeral type that must be defined with all the register class
  118.      names as enumeral values.  `NO_REGS' must be first.  `ALL_REGS'
  119.      must be the last register class, followed by one more enumeral
  120.      value, `LIM_REG_CLASSES', which is not a register class but rather
  121.      tells how many classes there are.
  122.      Each register class has a number, which is the value of casting
  123.      the class name to type `int'.  The number serves as an index in
  124.      many of the tables described below.
  125. `N_REG_CLASSES'
  126.      The number of distinct register classes, defined as follows:
  127.           #define N_REG_CLASSES (int) LIM_REG_CLASSES
  128. `REG_CLASS_NAMES'
  129.      An initializer containing the names of the register classes as C
  130.      string constants.  These names are used in writing some of the
  131.      debugging dumps.
  132. `REG_CLASS_CONTENTS'
  133.      An initializer containing the contents of the register classes, as
  134.      integers which are bit masks.  The Nth integer specifies the
  135.      contents of class N.  The way the integer MASK is interpreted is
  136.      that register R is in the class if `MASK & (1 << R)' is 1.
  137.      When the machine has more than 32 registers, an integer does not
  138.      suffice.  Then the integers are replaced by sub-initializers,
  139.      braced groupings containing several integers.  Each
  140.      sub-initializer must be suitable as an initializer for the type
  141.      `HARD_REG_SET' which is defined in `hard-reg-set.h'.
  142. `REGNO_REG_CLASS (REGNO)'
  143.      A C expression whose value is a register class containing hard
  144.      register REGNO.  In general there is more than one such class;
  145.      choose a class which is "minimal", meaning that no smaller class
  146.      also contains the register.
  147. `BASE_REG_CLASS'
  148.      A macro whose definition is the name of the class to which a valid
  149.      base register must belong.  A base register is one used in an
  150.      address which is the register value plus a displacement.
  151. `INDEX_REG_CLASS'
  152.      A macro whose definition is the name of the class to which a valid
  153.      index register must belong.  An index register is one used in an
  154.      address where its value is either multiplied by a scale factor or
  155.      added to another register (as well as added to a displacement).
  156. `REG_CLASS_FROM_LETTER (CHAR)'
  157.      A C expression which defines the machine-dependent operand
  158.      constraint letters for register classes.  If CHAR is such a
  159.      letter, the value should be the register class corresponding to
  160.      it.  Otherwise, the value should be `NO_REGS'.  The register
  161.      letter `r', corresponding to class `GENERAL_REGS', will not be
  162.      passed to this macro; you do not need to handle it.
  163. `REGNO_OK_FOR_BASE_P (NUM)'
  164.      A C expression which is nonzero if register number NUM is suitable
  165.      for use as a base register in operand addresses.  It may be either
  166.      a suitable hard register or a pseudo register that has been
  167.      allocated such a hard register.
  168. `REGNO_OK_FOR_INDEX_P (NUM)'
  169.      A C expression which is nonzero if register number NUM is suitable
  170.      for use as an index register in operand addresses.  It may be
  171.      either a suitable hard register or a pseudo register that has been
  172.      allocated such a hard register.
  173.      The difference between an index register and a base register is
  174.      that the index register may be scaled.  If an address involves the
  175.      sum of two registers, neither one of them scaled, then either one
  176.      may be labeled the "base" and the other the "index"; but whichever
  177.      labeling is used must fit the machine's constraints of which
  178.      registers may serve in each capacity.  The compiler will try both
  179.      labelings, looking for one that is valid, and will reload one or
  180.      both registers only if neither labeling works.
  181. `PREFERRED_RELOAD_CLASS (X, CLASS)'
  182.      A C expression that places additional restrictions on the register
  183.      class to use when it is necessary to copy value X into a register
  184.      in class CLASS.  The value is a register class; perhaps CLASS, or
  185.      perhaps another, smaller class.  On many machines, the following
  186.      definition is safe:
  187.           #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
  188.      Sometimes returning a more restrictive class makes better code.
  189.      For example, on the 68000, when X is an integer constant that is
  190.      in range for a `moveq' instruction, the value of this macro is
  191.      always `DATA_REGS' as long as CLASS includes the data registers.
  192.      Requiring a data register guarantees that a `moveq' will be used.
  193.      If X is a `const_double', by returning `NO_REGS' you can force X
  194.      into a memory constant.  This is useful on certain machines where
  195.      immediate floating values cannot be loaded into certain kinds of
  196.      registers.
  197. `PREFERRED_OUTPUT_RELOAD_CLASS (X, CLASS)'
  198.      Like `PREFERRED_RELOAD_CLASS', but for output reloads instead of
  199.      input reloads.  If you don't define this macro, the default is to
  200.      use CLASS, unchanged.
  201. `LIMIT_RELOAD_CLASS (MODE, CLASS)'
  202.      A C expression that places additional restrictions on the register
  203.      class to use when it is necessary to be able to hold a value of
  204.      mode MODE in a reload register for which class CLASS would
  205.      ordinarily be used.
  206.      Unlike `PREFERRED_RELOAD_CLASS', this macro should be used when
  207.      there are certain modes that simply can't go in certain reload
  208.      classes.
  209.      The value is a register class; perhaps CLASS, or perhaps another,
  210.      smaller class.
  211.      Don't define this macro unless the target machine has limitations
  212.      which require the macro to do something nontrivial.
  213. `SECONDARY_RELOAD_CLASS (CLASS, MODE, X)'
  214. `SECONDARY_INPUT_RELOAD_CLASS (CLASS, MODE, X)'
  215. `SECONDARY_OUTPUT_RELOAD_CLASS (CLASS, MODE, X)'
  216.      Many machines have some registers that cannot be copied directly
  217.      to or from memory or even from other types of registers.  An
  218.      example is the `MQ' register, which on most machines, can only be
  219.      copied to or from general registers, but not memory.  Some
  220.      machines allow copying all registers to and from memory, but
  221.      require a scratch register for stores to some memory locations
  222.      (e.g., those with symbolic address on the RT, and those with
  223.      certain symbolic address on the Sparc when compiling PIC).  In
  224.      some cases, both an intermediate and a scratch register are
  225.      required.
  226.      You should define these macros to indicate to the reload phase
  227.      that it may need to allocate at least one register for a reload in
  228.      addition to the register to contain the data.  Specifically, if
  229.      copying X to a register CLASS in MODE requires an intermediate
  230.      register, you should define `SECONDARY_INPUT_RELOAD_CLASS' to
  231.      return the largest register class all of whose registers can be
  232.      used as intermediate registers or scratch registers.
  233.      If copying a register CLASS in MODE to X requires an intermediate
  234.      or scratch register, `SECONDARY_OUTPUT_RELOAD_CLASS' should be
  235.      defined to return the largest register class required.  If the
  236.      requirements for input and output reloads are the same, the macro
  237.      `SECONDARY_RELOAD_CLASS' should be used instead of defining both
  238.      macros identically.
  239.      The values returned by these macros are often `GENERAL_REGS'.
  240.      Return `NO_REGS' if no spare register is needed; i.e., if X can be
  241.      directly copied to or from a register of CLASS in MODE without
  242.      requiring a scratch register.  Do not define this macro if it
  243.      would always return `NO_REGS'.
  244.      If a scratch register is required (either with or without an
  245.      intermediate register), you should define patterns for
  246.      `reload_inM' or `reload_outM', as required (*note Standard
  247.      Names::..  These patterns, which will normally be implemented with
  248.      a `define_expand', should be similar to the `movM' patterns,
  249.      except that operand 2 is the scratch register.
  250.      Define constraints for the reload register and scratch register
  251.      that contain a single register class.  If the original reload
  252.      register (whose class is CLASS) can meet the constraint given in
  253.      the pattern, the value returned by these macros is used for the
  254.      class of the scratch register.  Otherwise, two additional reload
  255.      registers are required.  Their classes are obtained from the
  256.      constraints in the insn pattern.
  257.      X might be a pseudo-register or a `subreg' of a pseudo-register,
  258.      which could either be in a hard register or in memory.  Use
  259.      `true_regnum' to find out; it will return -1 if the pseudo is in
  260.      memory and the hard register number if it is in a register.
  261.      These macros should not be used in the case where a particular
  262.      class of registers can only be copied to memory and not to another
  263.      class of registers.  In that case, secondary reload registers are
  264.      not needed and would not be helpful.  Instead, a stack location
  265.      must be used to perform the copy and the `movM' pattern should use
  266.      memory as a intermediate storage.  This case often occurs between
  267.      floating-point and general registers.
  268. `SECONDARY_MEMORY_NEEDED (CLASS1, CLASS2, M)'
  269.      Certain machines have the property that some registers cannot be
  270.      copied to some other registers without using memory.  Define this
  271.      macro on those machines to be a C expression that is non-zero if
  272.      objects of mode M in registers of CLASS1 can only be copied to
  273.      registers of class CLASS2 by storing a register of CLASS1 into
  274.      memory and loading that memory location into a register of CLASS2.
  275.      Do not define this macro if its value would always be zero.
  276. `SECONDARY_MEMORY_NEEDED_RTX (MODE)'
  277.      Normally, when `SECONDARY_MEMORY_NEEDED' is defined, the compiler
  278.      will allocate a stack slot when a memory location for a register
  279.      copy is needed.  If this macro is defined, the compiler instead
  280.      uses the memory location defined by this macro.
  281. `SMALL_REGISTER_CLASSES'
  282.      Normally the compiler will avoid choosing spill registers from
  283.      registers that have been explicitly mentioned in the rtl (these
  284.      registers are normally those used to pass parameters and return
  285.      values).  However, some machines have so few registers of certain
  286.      classes that there would not be enough registers to use as spill
  287.      registers if this were done.
  288.      You should define `SMALL_REGISTER_CLASSES' on those machines.  When
  289.      it is defined, the compiler allows registers explicitly used in
  290.      the rtl to be used as spill registers but prevents the compiler
  291.      from extending the lifetime of these registers.
  292.      Defining this macro is always safe, but unnecessarily defining
  293.      this macro will reduce the amount of optimizations that can be
  294.      performed in some cases.  If this macro is not defined but needs
  295.      to be, the compiler will run out of reload registers and print a
  296.      fatal error message.
  297.      For most machines, this macro should not be defined.
  298. `CLASS_LIKELY_SPILLED_P (CLASS)'
  299.      A C expression whose value is nonzero if pseudos that have been
  300.      assigned to registers of class CLASS would likely be spilled
  301.      because registers of CLASS are needed for spill registers.
  302.      The default value of this macro returns 1 if CLASS has exactly one
  303.      register and zero otherwise.  On most machines, this default
  304.      should be used.  Only define this macro to some other expression
  305.      if pseudo allocated by `local-alloc.c' end up in memory because
  306.      their hard registers were needed for spill regisers.  If this
  307.      macro returns nonzero for those classes, those pseudos will only
  308.      be allocated by `global.c', which knows how to reallocate the
  309.      pseudo to another register.  If there would not be another
  310.      register available for reallocation, you should not change the
  311.      definition of this macro since the only effect of such a
  312.      definition would be to slow down register allocation.
  313. `CLASS_MAX_NREGS (CLASS, MODE)'
  314.      A C expression for the maximum number of consecutive registers of
  315.      class CLASS needed to hold a value of mode MODE.
  316.      This is closely related to the macro `HARD_REGNO_NREGS'.  In fact,
  317.      the value of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be
  318.      the maximum value of `HARD_REGNO_NREGS (REGNO, MODE)' for all
  319.      REGNO values in the class CLASS.
  320.      This macro helps control the handling of multiple-word values in
  321.      the reload pass.
  322.    Three other special macros describe which operands fit which
  323. constraint letters.
  324. `CONST_OK_FOR_LETTER_P (VALUE, C)'
  325.      A C expression that defines the machine-dependent operand
  326.      constraint letters that specify particular ranges of integer
  327.      values.  If C is one of those letters, the expression should check
  328.      that VALUE, an integer, is in the appropriate range and return 1
  329.      if so, 0 otherwise.  If C is not one of those letters, the value
  330.      should be 0 regardless of VALUE.
  331. `CONST_DOUBLE_OK_FOR_LETTER_P (VALUE, C)'
  332.      A C expression that defines the machine-dependent operand
  333.      constraint letters that specify particular ranges of
  334.      `const_double' values.
  335.      If C is one of those letters, the expression should check that
  336.      VALUE, an RTX of code `const_double', is in the appropriate range
  337.      and return 1 if so, 0 otherwise.  If C is not one of those
  338.      letters, the value should be 0 regardless of VALUE.
  339.      `const_double' is used for all floating-point constants and for
  340.      `DImode' fixed-point constants.  A given letter can accept either
  341.      or both kinds of values.  It can use `GET_MODE' to distinguish
  342.      between these kinds.
  343. `EXTRA_CONSTRAINT (VALUE, C)'
  344.      A C expression that defines the optional machine-dependent
  345.      constraint letters that can be used to segregate specific types of
  346.      operands, usually memory references, for the target machine.
  347.      Normally this macro will not be defined.  If it is required for a
  348.      particular target machine, it should return 1 if VALUE corresponds
  349.      to the operand type represented by the constraint letter C.  If C
  350.      is not defined as an extra constraint, the value returned should
  351.      be 0 regardless of VALUE.
  352.      For example, on the ROMP, load instructions cannot have their
  353.      output in r0 if the memory reference contains a symbolic address.
  354.      Constraint letter `Q' is defined as representing a memory address
  355.      that does *not* contain a symbolic address.  An alternative is
  356.      specified with a `Q' constraint on the input and `r' on the
  357.      output.  The next alternative specifies `m' on the input and a
  358.      register class that does not include r0 on the output.
  359. File: gcc.info,  Node: Stack and Calling,  Next: Varargs,  Prev: Register Classes,  Up: Target Macros
  360. Stack Layout and Calling Conventions
  361. ====================================
  362. * Menu:
  363. * Frame Layout::
  364. * Frame Registers::
  365. * Elimination::
  366. * Stack Arguments::
  367. * Register Arguments::
  368. * Scalar Return::
  369. * Aggregate Return::
  370. * Caller Saves::
  371. * Function Entry::
  372. * Profiling::
  373. File: gcc.info,  Node: Frame Layout,  Next: Frame Registers,  Up: Stack and Calling
  374. Basic Stack Layout
  375. ------------------
  376. `STACK_GROWS_DOWNWARD'
  377.      Define this macro if pushing a word onto the stack moves the stack
  378.      pointer to a smaller address.
  379.      When we say, "define this macro if ...," it means that the
  380.      compiler checks this macro only with `#ifdef' so the precise
  381.      definition used does not matter.
  382. `FRAME_GROWS_DOWNWARD'
  383.      Define this macro if the addresses of local variable slots are at
  384.      negative offsets from the frame pointer.
  385. `ARGS_GROW_DOWNWARD'
  386.      Define this macro if successive arguments to a function occupy
  387.      decreasing addresses on the stack.
  388. `STARTING_FRAME_OFFSET'
  389.      Offset from the frame pointer to the first local variable slot to
  390.      be allocated.
  391.      If `FRAME_GROWS_DOWNWARD', find the next slot's offset by
  392.      subtracting the first slot's length from `STARTING_FRAME_OFFSET'.
  393.      Otherwise, it is found by adding the length of the first slot to
  394.      the value `STARTING_FRAME_OFFSET'.
  395. `STACK_POINTER_OFFSET'
  396.      Offset from the stack pointer register to the first location at
  397.      which outgoing arguments are placed.  If not specified, the
  398.      default value of zero is used.  This is the proper value for most
  399.      machines.
  400.      If `ARGS_GROW_DOWNWARD', this is the offset to the location above
  401.      the first location at which outgoing arguments are placed.
  402. `FIRST_PARM_OFFSET (FUNDECL)'
  403.      Offset from the argument pointer register to the first argument's
  404.      address.  On some machines it may depend on the data type of the
  405.      function.
  406.      If `ARGS_GROW_DOWNWARD', this is the offset to the location above
  407.      the first argument's address.
  408. `STACK_DYNAMIC_OFFSET (FUNDECL)'
  409.      Offset from the stack pointer register to an item dynamically
  410.      allocated on the stack, e.g., by `alloca'.
  411.      The default value for this macro is `STACK_POINTER_OFFSET' plus the
  412.      length of the outgoing arguments.  The default is correct for most
  413.      machines.  See `function.c' for details.
  414. `DYNAMIC_CHAIN_ADDRESS (FRAMEADDR)'
  415.      A C expression whose value is RTL representing the address in a
  416.      stack frame where the pointer to the caller's frame is stored.
  417.      Assume that FRAMEADDR is an RTL expression for the address of the
  418.      stack frame itself.
  419.      If you don't define this macro, the default is to return the value
  420.      of FRAMEADDR--that is, the stack frame address is also the address
  421.      of the stack word that points to the previous frame.
  422. `SERTUP_FRAME_ADDRESSES ()'
  423.      If defined, a C expression that produces the machine-specific code
  424.      to setup the stack so that arbitrary frames can be accessed.  For
  425.      example, on the Sparc, we must flush all of the register windows
  426.      to the stack before we can access arbitrary stack frames.  This
  427.      macro will seldom need to be defined.
  428. `RETURN_ADDR_RTX (COUNT, FRAMEADDR)'
  429.      A C expression whose value is RTL representing the value of the
  430.      return address for the frame COUNT steps up from the current frame.
  431.      fRAMEADDR is the frame pointer of the COUNT frame, or the frame
  432.      pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME'
  433.      is defined.
  434. `RETURN_ADDR_IN_PREVIOUS_FRAME'
  435.      Define this if the return address of a particular stack frame is
  436.      accessed from the frame pointer of the previous stack frame.
  437. File: gcc.info,  Node: Frame Registers,  Next: Elimination,  Prev: Frame Layout,  Up: Stack and Calling
  438. Registers That Address the Stack Frame
  439. --------------------------------------
  440. `STACK_POINTER_REGNUM'
  441.      The register number of the stack pointer register, which must also
  442.      be a fixed register according to `FIXED_REGISTERS'.  On most
  443.      machines, the hardware determines which register this is.
  444. `FRAME_POINTER_REGNUM'
  445.      The register number of the frame pointer register, which is used to
  446.      access automatic variables in the stack frame.  On some machines,
  447.      the hardware determines which register this is.  On other
  448.      machines, you can choose any register you wish for this purpose.
  449. `HARD_FRAME_POINTER_REGNUM'
  450.      On some machines the offset between the frame pointer and starting
  451.      offset of the automatic variables is not known until after register
  452.      allocation has been done (for example, because the saved registers
  453.      are between these two locations).  On those machines,
  454.      `FRAME_POINTER_REGNUM' as a special, fixed register to be used
  455.      internally until the offset is known, and define
  456.      `HARD_FRAME_POINTER_REGNUM' to be the hard register used for the
  457.      frame pointer.
  458.      You should define this macro only in the very rare circumstances
  459.      when it is not possible to calculate the offset between the frame
  460.      pointer and the automatic variables until after register
  461.      allocation has been completed.  When this macro is defined, you
  462.      must also indicate in your definition of `ELIMINABLE_REGS' how to
  463.      eliminate `FRAME_POINTER_REGNUM' into either
  464.      `HARD_FRAME_POINTER_REGNUM' or `STACK_POINTER_REGNUM'.
  465.      Do not define this macro if it would be the same as
  466.      `FRAME_POINTER_REGNUM'.
  467. `ARG_POINTER_REGNUM'
  468.      The register number of the arg pointer register, which is used to
  469.      access the function's argument list.  On some machines, this is
  470.      the same as the frame pointer register.  On some machines, the
  471.      hardware determines which register this is.  On other machines,
  472.      you can choose any register you wish for this purpose.  If this is
  473.      not the same register as the frame pointer register, then you must
  474.      mark it as a fixed register according to `FIXED_REGISTERS', or
  475.      arrange to be able to eliminate it (*note Elimination::.).
  476. `STATIC_CHAIN_REGNUM'
  477. `STATIC_CHAIN_INCOMING_REGNUM'
  478.      Register numbers used for passing a function's static chain
  479.      pointer.  If register windows are used, the register number as
  480.      seen by the called function is `STATIC_CHAIN_INCOMING_REGNUM',
  481.      while the register number as seen by the calling function is
  482.      `STATIC_CHAIN_REGNUM'.  If these registers are the same,
  483.      `STATIC_CHAIN_INCOMING_REGNUM' need not be defined.
  484.      The static chain register need not be a fixed register.
  485.      If the static chain is passed in memory, these macros should not be
  486.      defined; instead, the next two macros should be defined.
  487. `STATIC_CHAIN'
  488. `STATIC_CHAIN_INCOMING'
  489.      If the static chain is passed in memory, these macros provide rtx
  490.      giving `mem' expressions that denote where they are stored.
  491.      `STATIC_CHAIN' and `STATIC_CHAIN_INCOMING' give the locations as
  492.      seen by the calling and called functions, respectively.  Often the
  493.      former will be at an offset from the stack pointer and the latter
  494.      at an offset from the frame pointer.
  495.      The variables `stack_pointer_rtx', `frame_pointer_rtx', and
  496.      `arg_pointer_rtx' will have been initialized prior to the use of
  497.      these macros and should be used to refer to those items.
  498.      If the static chain is passed in a register, the two previous
  499.      macros should be defined instead.
  500. File: gcc.info,  Node: Elimination,  Next: Stack Arguments,  Prev: Frame Registers,  Up: Stack and Calling
  501. Eliminating Frame Pointer and Arg Pointer
  502. -----------------------------------------
  503. `FRAME_POINTER_REQUIRED'
  504.      A C expression which is nonzero if a function must have and use a
  505.      frame pointer.  This expression is evaluated  in the reload pass.
  506.      If its value is nonzero the function will have a frame pointer.
  507.      The expression can in principle examine the current function and
  508.      decide according to the facts, but on most machines the constant 0
  509.      or the constant 1 suffices.  Use 0 when the machine allows code to
  510.      be generated with no frame pointer, and doing so saves some time
  511.      or space.  Use 1 when there is no possible advantage to avoiding a
  512.      frame pointer.
  513.      In certain cases, the compiler does not know how to produce valid
  514.      code without a frame pointer.  The compiler recognizes those cases
  515.      and automatically gives the function a frame pointer regardless of
  516.      what `FRAME_POINTER_REQUIRED' says.  You don't need to worry about
  517.      them.
  518.      In a function that does not require a frame pointer, the frame
  519.      pointer register can be allocated for ordinary usage, unless you
  520.      mark it as a fixed register.  See `FIXED_REGISTERS' for more
  521.      information.
  522.      This macro is ignored and you do not need to define it if the
  523.      function `ELIMINABLE_REGS' is defined.
  524. `INITIAL_FRAME_POINTER_OFFSET (DEPTH-VAR)'
  525.      A C statement to store in the variable DEPTH-VAR the difference
  526.      between the frame pointer and the stack pointer values immediately
  527.      after the function prologue.  The value would be computed from
  528.      information such as the result of `get_frame_size ()' and the
  529.      tables of registers `regs_ever_live' and `call_used_regs'.
  530.      If `ELIMINABLE_REGS' is defined, this macro will be not be used and
  531.      need not be defined.  Otherwise, it must be defined even if
  532.      `FRAME_POINTER_REQUIRED' is defined to always be true; in that
  533.      case, you may set DEPTH-VAR to anything.
  534. `ELIMINABLE_REGS'
  535.      If defined, this macro specifies a table of register pairs used to
  536.      eliminate unneeded registers that point into the stack frame.  If
  537.      it is not defined, the only elimination attempted by the compiler
  538.      is to replace references to the frame pointer with references to
  539.      the stack pointer.
  540.      The definition of this macro is a list of structure
  541.      initializations, each of which specifies an original and
  542.      replacement register.
  543.      On some machines, the position of the argument pointer is not
  544.      known until the compilation is completed.  In such a case, a
  545.      separate hard register must be used for the argument pointer.
  546.      This register can be eliminated by replacing it with either the
  547.      frame pointer or the argument pointer, depending on whether or not
  548.      the frame pointer has been eliminated.
  549.      In this case, you might specify:
  550.           #define ELIMINABLE_REGS  \
  551.           {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
  552.            {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
  553.            {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
  554.      Note that the elimination of the argument pointer with the stack
  555.      pointer is specified first since that is the preferred elimination.
  556. `CAN_ELIMINATE (FROM-REG, TO-REG)'
  557.      A C expression that returns non-zero if the compiler is allowed to
  558.      try to replace register number FROM-REG with register number
  559.      TO-REG.  This macro need only be defined if `ELIMINABLE_REGS' is
  560.      defined, and will usually be the constant 1, since most of the
  561.      cases preventing register elimination are things that the compiler
  562.      already knows about.
  563. `INITIAL_ELIMINATION_OFFSET (FROM-REG, TO-REG, OFFSET-VAR)'
  564.      This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'.  It
  565.      specifies the initial difference between the specified pair of
  566.      registers.  This macro must be defined if `ELIMINABLE_REGS' is
  567.      defined.
  568. `LONGJMP_RESTORE_FROM_STACK'
  569.      Define this macro if the `longjmp' function restores registers from
  570.      the stack frames, rather than from those saved specifically by
  571.      `setjmp'.  Certain quantities must not be kept in registers across
  572.      a call to `setjmp' on such machines.
  573. File: gcc.info,  Node: Stack Arguments,  Next: Register Arguments,  Prev: Elimination,  Up: Stack and Calling
  574. Passing Function Arguments on the Stack
  575. ---------------------------------------
  576.    The macros in this section control how arguments are passed on the
  577. stack.  See the following section for other macros that control passing
  578. certain arguments in registers.
  579. `PROMOTE_PROTOTYPES'
  580.      Define this macro if an argument declared in a prototype as an
  581.      integral type smaller than `int' should actually be passed as an
  582.      `int'.  In addition to avoiding errors in certain cases of
  583.      mismatch, it also makes for better code on certain machines.
  584. `PUSH_ROUNDING (NPUSHED)'
  585.      A C expression that is the number of bytes actually pushed onto the
  586.      stack when an instruction attempts to push NPUSHED bytes.
  587.      If the target machine does not have a push instruction, do not
  588.      define this macro.  That directs GNU CC to use an alternate
  589.      strategy: to allocate the entire argument block and then store the
  590.      arguments into it.
  591.      On some machines, the definition
  592.           #define PUSH_ROUNDING(BYTES) (BYTES)
  593.      will suffice.  But on other machines, instructions that appear to
  594.      push one byte actually push two bytes in an attempt to maintain
  595.      alignment.  Then the definition should be
  596.           #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
  597. `ACCUMULATE_OUTGOING_ARGS'
  598.      If defined, the maximum amount of space required for outgoing
  599.      arguments will be computed and placed into the variable
  600.      `current_function_outgoing_args_size'.  No space will be pushed
  601.      onto the stack for each call; instead, the function prologue should
  602.      increase the stack frame size by this amount.
  603.      Defining both `PUSH_ROUNDING' and `ACCUMULATE_OUTGOING_ARGS' is
  604.      not proper.
  605. `REG_PARM_STACK_SPACE (FNDECL)'
  606.      Define this macro if functions should assume that stack space has
  607.      been allocated for arguments even when their values are passed in
  608.      registers.
  609.      The value of this macro is the size, in bytes, of the area
  610.      reserved for arguments passed in registers for the function
  611.      represented by FNDECL.
  612.      This space can be allocated by the caller, or be a part of the
  613.      machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says
  614.      which.
  615. `MAYBE_REG_PARM_STACK_SPACE'
  616. `FINAL_REG_PARM_STACK_SPACE (CONST_SIZE, VAR_SIZE)'
  617.      Define these macros in addition to the one above if functions might
  618.      allocate stack space for arguments even when their values are
  619.      passed in registers.  These should be used when the stack space
  620.      allocated for arguments in registers is not a simple constant
  621.      independent of the function declaration.
  622.      The value of the first macro is the size, in bytes, of the area
  623.      that we should initially assume would be reserved for arguments
  624.      passed in registers.
  625.      The value of the second macro is the actual size, in bytes, of the
  626.      area that will be reserved for arguments passed in registers.
  627.      This takes two arguments: an integer representing the number of
  628.      bytes of fixed sized arguments on the stack, and a tree
  629.      representing the number of bytes of variable sized arguments on
  630.      the stack.
  631.      When these macros are defined, `REG_PARM_STACK_SPACE' will only be
  632.      called for libcall functions, the current function, or for a
  633.      function being called when it is known that such stack space must
  634.      be allocated.  In each case this value can be easily computed.
  635.      When deciding whether a called function needs such stack space,
  636.      and how much space to reserve, GNU CC uses these two macros
  637.      instead of `REG_PARM_STACK_SPACE'.
  638. `OUTGOING_REG_PARM_STACK_SPACE'
  639.      Define this if it is the responsibility of the caller to allocate
  640.      the area reserved for arguments passed in registers.
  641.      If `ACCUMULATE_OUTGOING_ARGS' is defined, this macro controls
  642.      whether the space for these arguments counts in the value of
  643.      `current_function_outgoing_args_size'.
  644. `STACK_PARMS_IN_REG_PARM_AREA'
  645.      Define this macro if `REG_PARM_STACK_SPACE' is defined, but the
  646.      stack parameters don't skip the area specified by it.
  647.      Normally, when a parameter is not passed in registers, it is
  648.      placed on the stack beyond the `REG_PARM_STACK_SPACE' area.
  649.      Defining this macro suppresses this behavior and causes the
  650.      parameter to be passed on the stack in its natural location.
  651. `RETURN_POPS_ARGS (FUNTYPE, STACK-SIZE)'
  652.      A C expression that should indicate the number of bytes of its own
  653.      arguments that a function pops on returning, or 0 if the function
  654.      pops no arguments and the caller must therefore pop them all after
  655.      the function returns.
  656.      FUNTYPE is a C variable whose value is a tree node that describes
  657.      the function in question.  Normally it is a node of type
  658.      `FUNCTION_TYPE' that describes the data type of the function.
  659.      From this it is possible to obtain the data types of the value and
  660.      arguments (if known).
  661.      When a call to a library function is being considered, FUNTYPE
  662.      will contain an identifier node for the library function.  Thus, if
  663.      you need to distinguish among various library functions, you can
  664.      do so by their names.  Note that "library function" in this
  665.      context means a function used to perform arithmetic, whose name is
  666.      known specially in the compiler and was not mentioned in the C
  667.      code being compiled.
  668.      STACK-SIZE is the number of bytes of arguments passed on the
  669.      stack.  If a variable number of bytes is passed, it is zero, and
  670.      argument popping will always be the responsibility of the calling
  671.      function.
  672.      On the Vax, all functions always pop their arguments, so the
  673.      definition of this macro is STACK-SIZE.  On the 68000, using the
  674.      standard calling convention, no functions pop their arguments, so
  675.      the value of the macro is always 0 in this case.  But an
  676.      alternative calling convention is available in which functions
  677.      that take a fixed number of arguments pop them but other functions
  678.      (such as `printf') pop nothing (the caller pops all).  When this
  679.      convention is in use, FUNTYPE is examined to determine whether a
  680.      function takes a fixed number of arguments.
  681. File: gcc.info,  Node: Register Arguments,  Next: Scalar Return,  Prev: Stack Arguments,  Up: Stack and Calling
  682. Passing Arguments in Registers
  683. ------------------------------
  684.    This section describes the macros which let you control how various
  685. types of arguments are passed in registers or how they are arranged in
  686. the stack.
  687. `FUNCTION_ARG (CUM, MODE, TYPE, NAMED)'
  688.      A C expression that controls whether a function argument is passed
  689.      in a register, and which register.
  690.      The arguments are CUM, which summarizes all the previous
  691.      arguments; MODE, the machine mode of the argument; TYPE, the data
  692.      type of the argument as a tree node or 0 if that is not known
  693.      (which happens for C support library functions); and NAMED, which
  694.      is 1 for an ordinary argument and 0 for nameless arguments that
  695.      correspond to `...' in the called function's prototype.
  696.      The value of the expression should either be a `reg' RTX for the
  697.      hard register in which to pass the argument, or zero to pass the
  698.      argument on the stack.
  699.      For machines like the Vax and 68000, where normally all arguments
  700.      are pushed, zero suffices as a definition.
  701.      The usual way to make the ANSI library `stdarg.h' work on a machine
  702.      where some arguments are usually passed in registers, is to cause
  703.      nameless arguments to be passed on the stack instead.  This is done
  704.      by making `FUNCTION_ARG' return 0 whenever NAMED is 0.
  705.      You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the
  706.      definition of this macro to determine if this argument is of a
  707.      type that must be passed in the stack.  If `REG_PARM_STACK_SPACE'
  708.      is not defined and `FUNCTION_ARG' returns non-zero for such an
  709.      argument, the compiler will abort.  If `REG_PARM_STACK_SPACE' is
  710.      defined, the argument will be computed in the stack and then
  711.      loaded into a register.
  712. `FUNCTION_INCOMING_ARG (CUM, MODE, TYPE, NAMED)'
  713.      Define this macro if the target machine has "register windows", so
  714.      that the register in which a function sees an arguments is not
  715.      necessarily the same as the one in which the caller passed the
  716.      argument.
  717.      For such machines, `FUNCTION_ARG' computes the register in which
  718.      the caller passes the value, and `FUNCTION_INCOMING_ARG' should be
  719.      defined in a similar fashion to tell the function being called
  720.      where the arguments will arrive.
  721.      If `FUNCTION_INCOMING_ARG' is not defined, `FUNCTION_ARG' serves
  722.      both purposes.
  723. `FUNCTION_ARG_PARTIAL_NREGS (CUM, MODE, TYPE, NAMED)'
  724.      A C expression for the number of words, at the beginning of an
  725.      argument, must be put in registers.  The value must be zero for
  726.      arguments that are passed entirely in registers or that are
  727.      entirely pushed on the stack.
  728.      On some machines, certain arguments must be passed partially in
  729.      registers and partially in memory.  On these machines, typically
  730.      the first N words of arguments are passed in registers, and the
  731.      rest on the stack.  If a multi-word argument (a `double' or a
  732.      structure) crosses that boundary, its first few words must be
  733.      passed in registers and the rest must be pushed.  This macro tells
  734.      the compiler when this occurs, and how many of the words should go
  735.      in registers.
  736.      `FUNCTION_ARG' for these arguments should return the first
  737.      register to be used by the caller for this argument; likewise
  738.      `FUNCTION_INCOMING_ARG', for the called function.
  739. `FUNCTION_ARG_PASS_BY_REFERENCE (CUM, MODE, TYPE, NAMED)'
  740.      A C expression that indicates when an argument must be passed by
  741.      reference.  If nonzero for an argument, a copy of that argument is
  742.      made in memory and a pointer to the argument is passed instead of
  743.      the argument itself.  The pointer is passed in whatever way is
  744.      appropriate for passing a pointer to that type.
  745.      On machines where `REG_PARM_STACK_SPACE' is not defined, a suitable
  746.      definition of this macro might be
  747.           #define FUNCTION_ARG_PASS_BY_REFERENCE\
  748.           (CUM, MODE, TYPE, NAMED)  \
  749.             MUST_PASS_IN_STACK (MODE, TYPE)
  750. `FUNCTION_ARG_CALLEE_COPIES (CUM, MODE, TYPE, NAMED)'
  751.      If defined, a C expression that indicates when it is the called
  752.      function's responsibility to make a copy of arguments passed by
  753.      invisible reference.  Normally, the caller makes a copy and passes
  754.      the address of the copy to the routine being called.  When
  755.      FUNCTION_ARG_CALLEE_COPIES is defined and is nonzero, the caller
  756.      does not make a copy.  Instead, it passes a pointer to the "live"
  757.      value.  The called function must not modify this value.  If it can
  758.      be determined that the value won't be modified, it need not make a
  759.      copy; otherwise a copy must be made.
  760. `CUMULATIVE_ARGS'
  761.      A C type for declaring a variable that is used as the first
  762.      argument of `FUNCTION_ARG' and other related values.  For some
  763.      target machines, the type `int' suffices and can hold the number
  764.      of bytes of argument so far.
  765.      There is no need to record in `CUMULATIVE_ARGS' anything about the
  766.      arguments that have been passed on the stack.  The compiler has
  767.      other variables to keep track of that.  For target machines on
  768.      which all arguments are passed on the stack, there is no need to
  769.      store anything in `CUMULATIVE_ARGS'; however, the data structure
  770.      must exist and should not be empty, so use `int'.
  771. `INIT_CUMULATIVE_ARGS (CUM, FNTYPE, LIBNAME)'
  772.      A C statement (sans semicolon) for initializing the variable CUM
  773.      for the state at the beginning of the argument list.  The variable
  774.      has type `CUMULATIVE_ARGS'.  The value of FNTYPE is the tree node
  775.      for the data type of the function which will receive the args, or 0
  776.      if the args are to a compiler support library function.
  777.      When processing a call to a compiler support library function,
  778.      LIBNAME identifies which one.  It is a `symbol_ref' rtx which
  779.      contains the name of the function, as a string.  LIBNAME is 0 when
  780.      an ordinary C function call is being processed.  Thus, each time
  781.      this macro is called, either LIBNAME or FNTYPE is nonzero, but
  782.      never both of them at once.
  783. `INIT_CUMULATIVE_INCOMING_ARGS (CUM, FNTYPE, LIBNAME)'
  784.      Like `INIT_CUMULATIVE_ARGS' but overrides it for the purposes of
  785.      finding the arguments for the function being compiled.  If this
  786.      macro is undefined, `INIT_CUMULATIVE_ARGS' is used instead.
  787.      The value passed for LIBNAME is always 0, since library routines
  788.      with special calling conventions are never compiled with GNU CC.
  789.      The argument LIBNAME exists for symmetry with
  790.      `INIT_CUMULATIVE_ARGS'.
  791. `FUNCTION_ARG_ADVANCE (CUM, MODE, TYPE, NAMED)'
  792.      A C statement (sans semicolon) to update the summarizer variable
  793.      CUM to advance past an argument in the argument list.  The values
  794.      MODE, TYPE and NAMED describe that argument.  Once this is done,
  795.      the variable CUM is suitable for analyzing the *following*
  796.      argument with `FUNCTION_ARG', etc.
  797.      This macro need not do anything if the argument in question was
  798.      passed on the stack.  The compiler knows how to track the amount
  799.      of stack space used for arguments without any special help.
  800. `FUNCTION_ARG_PADDING (MODE, TYPE)'
  801.      If defined, a C expression which determines whether, and in which
  802.      direction, to pad out an argument with extra space.  The value
  803.      should be of type `enum direction': either `upward' to pad above
  804.      the argument, `downward' to pad below, or `none' to inhibit
  805.      padding.
  806.      The *amount* of padding is always just enough to reach the next
  807.      multiple of `FUNCTION_ARG_BOUNDARY'; this macro does not control
  808.      it.
  809.      This macro has a default definition which is right for most
  810.      systems.  For little-endian machines, the default is to pad
  811.      upward.  For big-endian machines, the default is to pad downward
  812.      for an argument of constant size shorter than an `int', and upward
  813.      otherwise.
  814. `FUNCTION_ARG_BOUNDARY (MODE, TYPE)'
  815.      If defined, a C expression that gives the alignment boundary, in
  816.      bits, of an argument with the specified mode and type.  If it is
  817.      not defined, `PARM_BOUNDARY' is used for all arguments.
  818. `FUNCTION_ARG_REGNO_P (REGNO)'
  819.      A C expression that is nonzero if REGNO is the number of a hard
  820.      register in which function arguments are sometimes passed.  This
  821.      does *not* include implicit arguments such as the static chain and
  822.      the structure-value address.  On many machines, no registers can be
  823.      used for this purpose since all function arguments are pushed on
  824.      the stack.
  825.